/**
 * @Description 下拉选择框
 * @return JSX
*/
const querySelect = function (paramOption, focus) {
    let { config, model, option } = paramOption;
    let h = this.$createElement;
    let prop = option.prop;
    return (
        <el-select v-focus={{ focus }} filterable onChange={() => config.handlerChange && config.handlerChange.call(this, paramOption)} v-model={model[prop]} clearable placeholder={config.placeholder || `请选择${option.label}`}>
            {config.optionList.map(option =>
                <el-option
                    key={option.id}
                    label={option.label}
                    value={option.id}>
                </el-option>
            )
            }
        </el-select >
    )
};
/**
 * @Description 远程下拉选择框
 * @return JSX
*/
const queryRemoteSelect = function (paramOption) {
    let { config, model, option } = paramOption;
    let h = this.$createElement;
    let prop = option.prop;
    return (
        <el-select
            v-model={model[prop]}
            multiple={config.multiple || false}
            filterable
            clearable
            remote
            reserve-keyword
            placeholder={config.placeholder || `联想输入-请输入关键词`}
            remote-method={(value) => config.remoteMethod(value, config)}
            loading={config.loading}
            onChange={() => config.handlerChange && config.handlerChange.call(this, paramOption)}
        >
            {config.optionList.map(option =>
                <el-option
                    key={option.id}
                    label={option.label}
                    value={option.id}>
                </el-option>
            )
            }
        </el-select>
    )
};
/**
 * @Description 文本输入框
 * @return JSX
*/
const queryInput = function ({ config, model, option }) {
    let h = this.$createElement;
    let prop = option.prop;
    return (
        <el-input
            v-model={model[prop]} onChange={() => config.handlerChange && config.handlerChange.call(this, paramOption)} clearable placeholder={config.placeholder || `请输入${option.label}`}>
        </el-input>
    )
};
/**
 * @Description 数字输入框
 * @param {paramOption:Object} 基础配置
 * @param {focus: boolean} 是否需要自动聚焦
 * @return JSX
*/
import NumberInput from './NumberInput.vue';
const queryNumberInput = function (paramOption, focus = false) {
    let { config, model, option } = paramOption;
    let h = this.$createElement;
    return <NumberInput focus={focus} paramOption={paramOption} placeholder={config.placeholder || `请输入${option.label}`} onChange={(value) => config.handlerChange && config.handlerChange.call(this, paramOption, value)} />
};
/**
 * @Description 单选框
 * @return JSX
*/
const queryRadio = function (paramOption) {
    let { config, model, option } = paramOption;
    let h = this.$createElement;
    let prop = option.prop;
    return (
        <el-radio-group onChange={() => config.handlerChange && config.handlerChange.call(this, paramOption)} v-model={model[prop]} >
            {config.optionList.map(option =>
                <el-radio label={option.id}>{option.label}</el-radio>
            )}
        </el-radio-group>
    )
};
/**
 * @Description 获取操作按钮
 * @return JSX
*/
const queryButtonList = function ({ config, model, option }) {
    let h = this.$createElement;
    let buttonList = option.buttonList.filter(option => !option.visible || option.visible(model));
    return (
        <div class="option-button-list">
            {buttonList.map(option => (
                <div class="option-button-item">
                    <el-button type="text" onClick={() => option.handlerClick && option.handlerClick(model)}>{option.label}</el-button>
                    <span>|</span>
                </div>
            ))}
        </div>
    )
}
/**
 * @Description 获取数字滚动组件
 * @param {isUseEasing: boolean} 是否使用缓和功能
 * @return JSX
*/
import CountTo from './CountTo.vue';
const queryCountTo = function (paramOption, isUseEasing = true) {
    let h = this.$createElement;
    let { model, option } = paramOption;
    let { prop, suffix } = option;
    return <CountTo isUseEasing={isUseEasing} value={option.customGet?.(model, option) ?? model[prop]} suffix={suffix} />
}
export { querySelect, queryInput, queryNumberInput, queryButtonList, queryCountTo, queryRemoteSelect, queryRadio }